home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 23.zip / BS1 part 23 / Prof page II type.adf / Install / RamCopy < prev    next >
AmigaDOS Script File  |  1990-08-10  |  2KB  |  68 lines

  1. .KEY src/A,dest/A,name,verb
  2. .BRA {
  3. .KET }
  4.  
  5. ; Try to copy src to dest via RAM:, to save disk swaps if it's a
  6. ; single-floppy, no-HD system.
  7. ; Failing that, copy directly from src to dest.
  8.  
  9.     failat 21
  10.  
  11.     echo >ENV:GDIRC "ok"        ; Default return code
  12.  
  13.     ; Try to copy via RAM:.  If we can't delete an old TempCopy, or can't
  14.     ; create the new one, punt and try to copy directly.  But a failure
  15.     ; to copy from TempCopy to dest is a real error -- don't bother retrying.
  16.  
  17.     if exists GD_TempDir:TempCopy
  18.         delete >NIL: GD_TempDir:TempCopy all
  19.         if error
  20.             skip RamCopyDirect
  21.         endif
  22.     endif
  23.  
  24.     ; Disable autorequesters for the copy to GD_TempDir:, to avoid
  25.     ; worrying the user if it fills up.
  26.     ; We do a dirsize on the source first, to make sure that disk is
  27.     ; inserted before the autorequesters get turned off.
  28.     if exists {src}                 ; Some fast access to the source
  29.     endif
  30.     instutil disable
  31.  
  32.     copy >NIL: {src} to GD_TempDir:TempCopy all quiet
  33.     if error
  34.         instutil enable             ; Turn autorequesters back on
  35.         skip RamCopyDirect
  36.     endif
  37.     instutil enable
  38.  
  39.     copy GD_TempDir:TempCopy {dest} all quiet
  40.     if error
  41.         echo >ENV:GDIRC "error"
  42.     endif
  43.     delete GD_TempDir:TempCopy all quiet
  44.     skip RamCopyWrapup
  45.  
  46.  
  47. ; RAM: copy failed.  Try to do it directly.
  48. lab RamCopyDirect
  49.     delete >NIL: GD_TempDir:TempCopy all    ; Get back some memory
  50.     copy {src} {dest} all quiet
  51.     if error
  52.         echo >ENV:GDIRC "error"
  53.     endif
  54.  
  55. lab RamCopyWrapup
  56.     failat 10
  57.  
  58.     if $GDIRC eq "ok"
  59.         if not "{name}" eq ""
  60.             echo "{name} {verb}"
  61.         endif
  62.     else
  63.         if not "{name}" eq ""
  64.             echo "*E[;33m{name} not {verb}*E[m"
  65.         endif
  66.         echo >GD_TempDir:Message "*E[;33m Installation did not complete properly.*E[m"
  67.     endif
  68.